[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+--------------+###########################################################
#+-| FIND_FIRST() |-----------------------------------------+#################
#| +--------------+ Locates the first file matching pattern |#################
#+----------------------------------------------------------+#################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE system.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------------------------+#############
#| FUNCTION LOGICAL find_first PROTOTYPE |#############
#| PARAMETERS CONST CHAR pattern, VALUE UINT attribute |#############
#+--------------------------------------------------------------+#############
##############################################################################
##############################################################################
#######+---| Description |--------------------------------------------+#######
#######| The find_first() function locates the first file matching |#######
#######| pattern. It returns TRUE if the file is found or else it |#######
#######| returns FALSE. pattern is the file or directory path. |#######
#######| find_first() supports the DOS wildcard characters * and ? |#######
#######| ------------------------------------------------------------ |#######
#######| To find the next file within a sequence, use the find_next() |#######
#######| function. |#######
#######| ------------------------------------------------------------ |#######
#######| Use the function find_fstr() to obtain the filename found |#######
#######| by find_first(). The functions find_fdate(), find_ftime() |#######
#######| and find_fsize() return the files date, time and size. |#######
#######| ------------------------------------------------------------ |#######
#######| The parameter attribute specifies what type of files are to |#######
#######| be located. System files(ibmbio.com and ibmdos.com), hidden |#######
#######| files (can not be viewed by the DOS DIR command) and a drive |#######
#######| volume can be specified. |#######
#######| ------------------------------------------------------------ |#######
#######| The include file system.hdr contains common defines for |#######
#######| atrribute. see also the DIRECTORY SEARCH ATTRIBUTES TABLE. |#######
#######| To search for normal files, use the attribute 0x20. |#######
#######+--------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Procedure to print a file's size, date and time. |#########
#########| |#########
#########| PROCEDURE filedata |#########
#########| PARAMETERS CONST CHAR filename |#########
#########| |#########
#########| IF .NOT. find_first( filename, 0x20 ) |#########
#########| ? "File not found" |#########
#########| RETURN |#########
#########| ENDIF |#########
#########| |#########
#########| ? filename+str( find_fsize())+" bytes" |#########
#########| ? " time is "+find_ftime() |#########
#########| ? " date is "+dtoc( find_fdate() ) |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Print out the volume label of the current drive. |#########
#########| |#########
#########| #include system.hdr |#########
#########| |#########
#########| {...} |#########
#########| FIND_FIRST( "C:\", &FIND_VOLUME ) |#########
#########| ? find_fstr() |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Get a listing of filenames into a pick list. |#########
#########| |#########
#########| VARDEF |#########
#########| LONG plist |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE fill_list_with_names |#########
#########| PARAMETERS CONST CHAR the_path |#########
#########| |#########
#########| plist = pick_init() |#########
#########| IF .NOT. find_first( the_path, 0x20 ) |#########
#########| pick_add( plist, "No files found" ) |#########
#########| ENDIF |#########
#########| |#########
#########| REPEAT |#########
#########| pick_add( plist, find_fstr() ) |#########
#########| UNTIL .NOT. find_next() |#########
#########| |#########
#########| ENDPRO |#########
#########| |#########
#########| {...} |#########
#########| *--- call "fill_list_with_names" for *.* |#########
#########| DO fill_list_with_names WITH "*.*" |#########
#########| |#########
#########| {...} |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
find_next()
find_fdate()
find_ftime()
...
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson